<?php
class WebEnumModel extends Model {
	var $_table = 'web_enum';
	
	var $enum_id_nak; //INT UNSIGNED NOT NULL AUTO_INCREMENT,
	var $enum_type_sr; //VARCHAR(16) NOT NULL COMMENT '枚举类型,如作者,来源,关键词等',
	var $enum_val_sr; //VARCHAR(128) NOT NULL COMMENT '枚举值',
	

	/**
	 * 
	 * 取枚举值
	 * @param string $enum 枚举类型
	 * @param string $val 枚举值
	 */
	public function getEnums($enum, $val = '') {
		$where ['enum_type'] = $enum;
		if (! empty ( $val )) {
			$where ['enum_val LIKE '] = "%{$val}%";
		}
		$enums = $this->where ( $where )->retrieve ( 'enum_id,enum_val' );
		return $enums;
	}

}